<script type="text/javascript">
    $(function () {

        $('.profile_chart_toggle').click(function () {
            var def = 'Tip: Pozrite si graf zobrazený nižšie';
            $('#container').slideToggle();
            if ($(this).text() == def) {
                $(this).text('Skryť zobrazený graf');
                return false;
            }
            $(this).text(def);
        });

        var chart;
        $(document).ready(function () {
            // Build the chart
            chart = new Highcharts.Chart({
                chart:{
                    renderTo:'container',
                    plotBackgroundColor:null,
                    plotBorderWidth:null,
                    plotShadow:false
                },
                title:{
                    text:' '
                },
                tooltip:{
                    pointFormat:'<b>{series.name}</b>: {point.percentage}%',
                    percentageDecimals:1
                },
                plotOptions:{
                    pie:{
                        allowPointSelect:true,
                        cursor:'pointer',
                        dataLabels:{
                            enabled:false
                        },
                        showInLegend:true
                    }
                },
                series:[
                    {
                        type:'pie',
                        name:'Percent: ',
                        data:[
                            ['Radarov',   <?php echo $reports['n_police'] ?>],
                            ['Hliadok',    <?php echo $reports['n_patrol'] ?>],
                            ['Nehôd',     <?php echo $reports['n_accident'] ?>],
                            ['Mobilných radarov',   <?php echo $reports['n_mobileradar'] ?>]
                        ]
                    }
                ]
            });
        });

    });
    jQuery(document).ready(function () {

        $('a[rel*=facebox]').facebox();
    });

</script>

<?php
echo "<a style='text-decoration:none;color:red;font-weight:bold;' href='" . base_url() . "myprofile'>Zobraziť profil</a> | <a href='" . base_url() . "changeProfile/pw' rel='facebox' style='text-decoration:none;color:black;'>Zmena hesla</a>";
echo " | ";
echo "<a href='" . base_url() . "changeProfile/email' rel='facebox' style='text-decoration:none;color:black;'>Zmena e-mailu</a>";
echo "<div style='padding-top: 10px;'/>";
echo "Mnou vygenerovaných ciest: " . $count;
if (isset($kms))
    echo " (" . $kms . " kilometrov)";
echo "<div style='padding-top: 10px;'/>";
echo "Moje pridané udalosti celkom:<ul>";
echo "<li>Radarov: " . $reports['n_police'] . "</li>";
echo "<li>Hliadok: " . $reports['n_patrol'] . "</li>";
echo "<li>Nehôd: " . $reports['n_accident'] . "</li>";
echo "<li>Mobilných radarov: " . $reports['n_mobileradar'] . "</li></ul>";
if ($reports['n_police'] > 0 || $reports['n_patrol'] > 0 || $reports['n_accident'] > 0 || $reports['n_mobileradar'] > 0)
    echo "<span class='profile_chart_toggle' style='color:gray;font-size:9px;cursor:pointer;'>Tip: Pozrite si graf zobrazený nižšie</span>";
?>

<div id="container" style="min-width: 400px;height: 280px; margin: 0 auto;display:none;"></div>
